Skip to content

Add metadata latency sensitivity analysis to DuckLake concurrency benchmarks#382

Merged
fuziontech merged 4 commits intomainfrom
test/ducklake-latency-sensitivity
Apr 2, 2026
Merged

Add metadata latency sensitivity analysis to DuckLake concurrency benchmarks#382
fuziontech merged 4 commits intomainfrom
test/ducklake-latency-sensitivity

Conversation

@fuziontech
Copy link
Copy Markdown
Member

Summary

  • TCP latency proxy (latency_proxy.go) that injects configurable bidirectional delay between DuckDB/DuckLake and the metadata PostgreSQL, enabling analysis of how network latency (simulating cross-region RDS) affects transaction conflict rates
  • DUCKGRES_BENCH_LATENCIES env var — comma-separated latency sweep, e.g. 0ms,25ms,50ms,100ms. Default: 0ms (backward-compatible, no behavior change)
  • Per-latency duckgres harnesses — each latency level gets a fresh duckgres server with a TCP proxy in front of the metadata PostgreSQL
  • JSON report schema — adds metadata_latency_ms per metric and latencies_tested_ms to the report for downstream comparison
  • justfile recipes: bench-ducklake-latency (single version, latency sweep) and bench-ducklake-full-matrix (version × latency 2D matrix)
  • Version matrix script passes through DUCKGRES_BENCH_LATENCIES for 2D analysis

Usage

# Quick latency sweep on current version
just bench-ducklake-latency 0ms,25ms,50ms,100ms

# Full version × latency matrix
DUCKGRES_BENCH_LATENCIES=0ms,50ms,100ms just bench-ducklake-matrix

# Or directly
DUCKGRES_BENCH_LATENCIES=0ms,50ms go test -v -run TestDuckLakeConcurrentTransactions -timeout 600s ./tests/integration/...

How it works

The latency proxy sits between DuckDB's DuckLake extension and the metadata PostgreSQL:

DuckDB → DuckLake ext → [TCP Latency Proxy (+Xms per direction)] → Metadata PostgreSQL

Each read/write to the proxy gets a time.Sleep(latency) before forwarding, so a 50ms setting adds ~100ms RTT overhead — matching cross-region RDS latency.

Architecture

  • LatencyProxy is a plain Go TCP proxy (no external dependencies)
  • For 0ms latency, the default test harness is used directly (zero overhead)
  • For non-zero latencies, a fresh TestHarness is created per latency level with the proxy wired in
  • All harnesses share the same metadata PostgreSQL and MinIO containers
  • Test structure: TestDuckLakeConcurrentTransactions/latency_0ms/concurrent_inserts_same_table

Test plan

  • TestLatencyProxy — zero latency forwarding, measurable latency (~100ms RTT for 50ms one-way), close terminates connections
  • All existing integration tests pass
  • go vet ./... clean
  • Compilation succeeds
  • CI passes
  • DuckLake concurrency tests with DUCKGRES_BENCH_LATENCIES=0ms,50ms (requires DuckLake infra)

🤖 Generated with Claude Code

…chmarks

Introduces a TCP latency proxy that injects configurable one-way delay between
DuckDB/DuckLake and the metadata PostgreSQL, enabling sensitivity analysis of
how network latency affects transaction conflict rates.

Key changes:
- TCP latency proxy (latency_proxy.go) with bidirectional delay injection
- DUCKGRES_BENCH_LATENCIES env var to sweep latencies (e.g. 0ms,25ms,50ms,100ms)
- Per-latency duckgres harnesses with proxy in front of metadata PostgreSQL
- JSON report includes metadata_latency_ms per metric and latencies_tested_ms
- justfile recipes: bench-ducklake-latency, bench-ducklake-full-matrix
- Version matrix script passes through latency config for 2D (version x latency) analysis

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@fuziontech fuziontech force-pushed the test/ducklake-latency-sensitivity branch from 20837c2 to 183f248 Compare April 1, 2026 17:11
fuziontech and others added 3 commits April 1, 2026 11:22
…flicts

Reproduces the full SQLMesh model execution pattern: each concurrent model
does CREATE OR REPLACE TABLE ... AS SELECT followed by COMMENT ON TABLE to
set the model description. The COMMENT is a separate DDL hitting the DuckLake
metadata store, widening the conflict window — matching the prod log pattern:
  /* SQLMESH_PLAN: ... */ COMMENT ON TABLE "schema"."model" IS 'description'

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Documents how to run the concurrency benchmarks, latency sensitivity
analysis, version matrix, JSON output schema, and environment variables.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@fuziontech fuziontech enabled auto-merge (squash) April 2, 2026 04:11
@fuziontech fuziontech merged commit 4e19a03 into main Apr 2, 2026
21 checks passed
@fuziontech fuziontech deleted the test/ducklake-latency-sensitivity branch April 2, 2026 04:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant